<?php
/* 
 * Copyright (c) 2018-2021  * 
 * 创建时间：2021-04-24 06:14
 *
 * 项目：upload  -  $  - levssqController.php
 *
 * 作者：liwei 
 */


namespace modules\levmodules\controllers;

!defined('INLEV') && exit('Access Denied LEV');

use lev\base\Migrationv;
use lev\widgets\inputs\tablesForm;
use modules\levfm\table\LevfmFields;
use modules\levfm\table\LevfmForms;
use Lev;
use lev\base\Adminv;
use lev\base\Assetsv;
use lev\base\Controllerv;
use lev\base\Modelv;
use lev\base\Viewv;
use lev\helpers\cacheFileHelpers;
use lev\helpers\dbHelper;
use lev\helpers\ModulesHelper;
use lev\helpers\SettingsHelper;
use lev\widgets\inputs\inputsWidget;
use modules\levmodules\levmodulesHelper;

Adminv::checkAccess();
Assetsv::registerSuperman();

class SettingsController extends Controllerv {

    /**
     * Renders the index view for the module
     */
    public function actionIndex()
    {

        $iden = Lev::stripTags(Lev::GPv('iden'));

        if ($adminop = Lev::POSTv('adminop')) {
            switch ($adminop) {
                case 'setStatus' : $tips = SettingsHelper::setStatus(); break;
                case 'setField'  : $tips = static::setField(); inputsWidget::setCaches($iden); break;
                case 'deleteDay' : $tips = SettingsHelper::adminDayDelete(); inputsWidget::setCaches(); break;
                case 'deleteIds' : $tips = SettingsHelper::adminDelete(); inputsWidget::setCaches(); break;
            }
            if (isset($tips)) {
                echo json_encode($tips);
                return;
            }
        }elseif (Lev::POSTv('dosubmit')) {
            echo json_encode(static::save());
            return;
        }

        $classify = Lev::stripTags(Lev::GPv('classify'));
        $inputtypes = inputsWidget::inputtype();
        $modules = ModulesHelper::findAll(1, 'identifier');

        $settings = $iden ? SettingsHelper::getModuleSettingsInfo($iden, '', $classify) : SettingsHelper::findAll(1);
        $setClassify = ModulesHelper::getClassify($iden);

        $tabClassify = SettingsHelper::tabClassify($iden);
        $setClassify+= $tabClassify;

        $setClassify = ModulesHelper::getSetClassify($iden, $setClassify);

        Lev::$app['title'] = '模块 设置项 配置';
        $tips = '';

        $create_classify = $classify;
        if ($isForm = (Lev::GPv('isForm') || isset($tabClassify[$classify]))) {
            Lev::$app['title'] = '模块 表单 配置';
            $tips = '表单分步填为0时为设置项，否则为数据表字段';
            $settings = SettingsHelper::getModuleTabSettings($iden, $classify);
            if (!isset($tabClassify[$classify]) && $tabClassify) {
                $tabClassifyFill = array_flip($tabClassify);
                $create_classify = end($tabClassifyFill);
            }
        }

        if (!$create_classify && $end = end($settings)) {
            $create_classify = $end['classify'];
        }

        Viewv::render('settings/index', [
            'iden' => static::saveIden(),
            'settings' => $settings,
            'inputtypes' => $inputtypes,
            'modules' => $modules,
            'setClassify' => $setClassify,
            'tabClassify' => $tabClassify,
            'tips' => $tips,
            'isForm' => $isForm,
            'mudInfo' => ModulesHelper::getModuleInfo($iden),
            'create_classify' => $create_classify,
        ]);

    }

    public static function actionQuickCreateForm() {
        $iden = Lev::stripTags(Lev::GPv('iden'));
        $tabname = Lev::stripTags(Lev::GPv('tabname'));

        $classify = Migrationv::quoteTableName($tabname, false);
        $_POST['status'] = 1;
        $_POST['classify'] = $classify;
        $_POST['inputtype'] = 'text';
        $_POST['iden'] = $iden;
        if (strpos($tabname, '{{%') === 0) {
            $tablename = Migrationv::quoteTableName($tabname, true);
        }else {
            $tablename = Lev::$app['db']['prefix'] . $tabname;
        }
        $columns = dbHelper::getColumnsComment($tablename);
        if (!empty($columns)) {
            foreach ($columns as $field => $name) {
                if (in_array($field, ['id', 'uptime', 'addtime', 'settings', 'status'])) {
                    continue;
                }
                $_POST['title'] = $name;
                $_POST['inputname'] = $field;
                $resMsgs[] = [$field, $name, static::save()];
            }

            Lev::showMessages(Lev::responseMsg(2, '创建完成<script>Levme.setTimeout(function() {window.location.reload()}, 1500);</script>'));
            //Lev::showMessages(Lev::responseMsg(1, '', ['htms'=>'<div class="page-content" style="background:black;color: white;"><pre>'.print_r($resMsgs, true).'</pre></div>']));
        }else {
            Lev::showMessages(Lev::responseMsg(-1, '表中【'.$tablename.'】没有字段或表不存在'));
        }
    }

    public function actionForm() {

        if (Lev::POSTv('dosubmit')) {
            echo json_encode(static::save());
            return;
        }

        $iden = static::saveIden();
        $opid = intval(Lev::GETv('opid'));

        $modInfo = ModulesHelper::getModuleInfo($iden);
        $opInfo = $opid >0 ? SettingsHelper::findOne(['id'=>$opid]) : [];
        $inputs = static::formInputs();

        if ($opInfo) {
            tablesForm::checkInputtype($opInfo['inputtype']) &&
            $opInfo = Modelv::setFormSettings($opInfo['settings'], $opInfo);//print_r($opInfo);
            Lev::$app['title'] = '正在为模块【' . $modInfo['name'] . '】更新【'.$opInfo['title'].'】设置项';
        }else {
            Lev::$app['title'] = '正在为模块【' . $modInfo['name'] . '】创建设置项';
        }

        Viewv::render('settings/form', [
            'iden' => $iden,
            'inputs' => $inputs,
            'inputsValues' => $opInfo,
        ]);

    }

    public function actionExport()
    {
        if (!Lev::GETv('ac')) {
            Lev::showMessage('请选择要导出的数据！',[
                '导出设置' => Lev::toCurrent(['ac'=>1]),
                '导出表单字段' => Lev::toCurrent(['ac'=>3]),
                '导出表数据' => Lev::toCurrent(['ac'=>2]),
            ], 'info');
            return;
        }

        if (Lev::POSTv('dosubmit')) {
            echo json_encode(static::doExport());
            return;
        }
        if (in_array(Lev::GPv('ac'), [1])) {

            $identifier = static::saveIden();

            $modInfo = ModulesHelper::getModuleInfo($identifier);
            $settings = SettingsHelper::getModuleSettingsInfo($identifier);
            $settings = static::getExportSettingsData($settings, Lev::GPv('onlyForm'));

            Lev::$app['title'] = $modInfo['name'].' &raquo; 导出设置项';
            $tips = '导出文件位于：@modules/'.ModulesHelper::getIdenDir($identifier).'/migrations/data/settings.php';

            Viewv::render('settings/export', [
                'tips' => $tips,
                'settings' => static::doExport(true),
            ]);

        }else if (in_array(Lev::GPv('ac'), [3])) {

            $identifier = static::saveIden();
            $tabName = Lev::stripTags(Lev::GPv('optab'));

            $modInfo = ModulesHelper::getModuleInfo($identifier);
            $tables = unserialize($modInfo['settings']);
            !$tabName && $tabName = end($tables['dropTables']);
            if ($tabName) {
                $tabName = dbHelper::tableName($tabName);
                $formInfo = LevfmForms::findOne(['name'=>$tabName]);
                $settings = LevfmFields::findAll(['formid'=>$formInfo['id']], 'inputname', ['displayorder ASC', 'id DESC']);
                $settings = static::getExportSettingsData($settings, true);
            }

            Lev::$app['title'] = $modInfo['name'].' &raquo; 导出表单字段';
            $tips = '导出文件位于：@modules/'.ModulesHelper::getIdenDir($identifier).'/migrations/data/__table/';

            Viewv::render('settings/export_form', [
                'tips' => $tips,
                'settings' => $settings,
                'optab' => $tabName,
                'tables' => $tables['dropTables'],
            ]);

        }else {

            $dballtab = intval(Lev::GPv('dballtab'));
            $identifier = static::saveIden();
            $tips = '导出文件位于：@modules/'.ModulesHelper::getIdenDir($identifier).'/migrations/data/ 目录下面';

            $modInfo = ModulesHelper::getModuleInfo($identifier);

            $version = '';
            $noTables = $allTables = $parentTables = [];
            $dbTables = dbHelper::getTableNames(Lev::$app['db']['prefix'].'lev');//print_r($dbTables);exit('0--');
            if ($modInfo['classdir']) {
                $pmodInfo = ModulesHelper::getModuleInfo($modInfo['classdir']);
                $ss = unserialize($pmodInfo['settings']);
                $parentTables = !empty($ss['dropTables']) ? $ss['dropTables'] : [];
            }

            if ($dballtab) {
                $myTables = $dbTables;
                !$identifier && $tips = '导出文件位于：@modules/'.ModulesHelper::getIdenDir($identifier).'/runtime/_DBbackup/ 目录下面';
            }else {
                $settings = unserialize($modInfo['settings']);
                $myTables = !empty($settings['dropTables']) ? $settings['dropTables'] : [];
                foreach ($myTables as $k => $v) $myTables[$k] = Modelv::tableName($v);
                $identTab = str_replace('/', '_', $identifier);
                $identTab2 = str_replace('s/', '', $identifier);
                $identTab3 = str_replace('/', '', $identifier);
                foreach ($dbTables as $v) {
                    if (!in_array($v, $myTables) && (strpos($v, $identTab) !== false || strpos($v, $identTab2) !== false || strpos($v, $identTab3) !== false)) {
                        $noTables[] = $v;
                    }
                }
                $version = urlencode(Lev::getAlias('@modules/'.ModulesHelper::getIdenDir($identifier).'/migrations/data/'));
            }

            Lev::$app['title'] = $modInfo['name'].' &raquo; 导出表数据';
            Viewv::render('settings/export_datatable', [
                'tips' => $tips,
                'version' => $version,
                'myTables' => $myTables,
                'noTables' => $noTables,
                'allTables' => dbHelper::getTableNames(''),
                'parentTables' => $parentTables,
            ]);

        }
    }

    /**
     * @return array|string
     */
    public static function doExport($preview = false, $iden = '') {

        ini_set('memory_limit', '-1');
        $inLev = cacheFileHelpers::getCheckINLEVphpcode();
        $identifier = $iden ?: static::saveIden();
        if ($tnames = trim(strip_tags(Lev::POSTv('tablename')))) {
            $tabNames = explode(',', trim(trim($tnames), ','));
            $tname = $tabNames[0];
            if (!$tname) {
                return (Lev::responseMsg(1, '导出完成！共'.count($tabNames).'张表'));
            }
            if ($identifier) {
                $file = Lev::getAlias($xfile = '@modules/'.ModulesHelper::getIdenDir($identifier).'/migrations/data/');
            }else {
                $file = Lev::getAlias($xfile = '@runtime/_DBbackup/'.date('Ymd', time()).'/');
            }
            $preTableName = Modelv::tableName($tname);
            if (dbHelper::existsTable($preTableName)) {
                if (Lev::$app['db']['prefix'] != 'pre_') {
                    $preTableName = 'pre_'.substr($preTableName, strlen(Lev::$app['db']['prefix']));
                }
                $page = max(intval(Lev::POSTv('page')), 1);
                $file .= $preTableName . '/';
                if ($page == 1) {
                    cacheFileHelpers::rmdirv($file);
                }
                cacheFileHelpers::mkdirv($file);
                $filename = $preTableName . '_' . $page . '.php';
                $limit = 3000;
                $offset = ($page - 1) * $limit;
                if (Lev::GPv('cto')) {
                    $sql = "SELECT myct,c_t,c_r,opentime,openinfo,settings FROM ".$tname." ORDER BY `c_t`+0 ASC LIMIT $offset,$limit";
                }else {
                    $sql = "SELECT * FROM " . $tname . " WHERE id>0 ORDER BY id ASC LIMIT $offset,$limit";
                }
                $datas = dbHelper::findAll($sql);

                //$datas && file_put_contents($file . $filename, '<?php '.$inLev.' return ' . var_export($datas, true) . ';');
                $datas && file_put_contents($file . $filename, '<?php '.$inLev.' return ' . cacheFileHelpers::varExportSerialize($datas) . ';');

                $nextPage = count($datas) < $limit ? 0 : $page + 1;
                $pdata = ['page' => $nextPage];
                if (!$nextPage) {
                    unset($tabNames[0]);
                }
            }else {
                $filename = '表不存【'.$preTableName.'】';
                unset($tabNames[0]);
            }
            $tabNames && $pdata['tablename'] = implode(',', $tabNames);
            return (Lev::responseMsg(1, '导出文件位于：<br>'.$xfile.$filename, $pdata));
        }else {
            $file = Lev::getAlias('@modules/'.ModulesHelper::getIdenDir($identifier).'/migrations/data/');
            if ($tabName = Lev::stripTags(Lev::GPv('optab'))) {
                $file = Lev::getAlias('@modules/'.ModulesHelper::getIdenDir($identifier).'/migrations/data/__table/');
                $formInfo = LevfmForms::findOne(['name'=>$tabName]);
                $settings = LevfmFields::findAll(['formid'=>$formInfo['id']], 'inputname', ['displayorder ASC', 'id DESC']);
                $settings = static::getExportSettingsData($settings, true);
                $filename = $tabName;
            }else {
                $settings = SettingsHelper::getModuleSettingsInfo($identifier);
                $settings = static::getExportSettingsData($settings, Lev::GPv('onlyForm'));
                $filename = 'settings';
            }
            $data = '<?php ' . $inLev . ' return ' . cacheFileHelpers::varExportSerialize($settings);
            if ($preview) {//导出预览
                return $data;
            }
            cacheFileHelpers::mkdirv($file);
            //file_put_contents($file . $filename . '.php', '<?php ' . $inLev . ' return ' . var_export($settings, true) . ';');
            file_put_contents($file . $filename . '.php', $data);
            return (Lev::responseMsg());
        }
    }

    public static function getExportSettingsData($settings, $onlyForm = 0) {
        foreach ($settings as $k => $v) {
            if ($onlyForm === 'field') {
                $fields[$v['inputname']] = $v['title'];
            }else if ($onlyForm === 'val') {
                $fields[$v['inputname']] = $v['inputvalue'];
            }else {
                unset($settings[$k]['id']);
                if ($onlyForm) {
                    unset($settings[$k]['moduleidentifier'], $settings[$k]['uptime'], $settings[$k]['addtime']);
                }
            }
            if (in_array($v['inputname'], ['pwd', 'password']) || substr($v['inputname'], -3) === 'Pwd') {//将密码字段设置为空值
                $settings[$k]['inputvalue'] = '';
            }elseif (inputsWidget::checkTablesField($v['inputtype'])) {
                $set = Lev::getSettings($v['inputvalue']);
                foreach ($set as $k2 => $v2) {

//                    if (isset($v2['pwd'])) {//将密码字段设置为空值
//                        $set[$k2]['pwd'] = '';
//                    }elseif (isset($v2['password'])) {//将密码字段设置为空值
//                        $set[$k2]['password'] = '';
//                    }
                    if (!empty($v2['cld__'])) {
                        foreach ($v2['cld__'] as $k3 => $v3) {
                            $v2['cld__'][$k3] = static::emptyPwd($v3);
                        }
                    }
                    $set[$k2] = static::emptyPwd($v2);
                }
                $settings[$k]['inputvalue'] = Lev::setSettings($set);
            }
        }
        return isset($fields) ? $fields : $settings;
    }
    public static function emptyPwd($fieldInfo) {
        foreach ($fieldInfo as $k => $v) {
            if (in_array($k, ['pwd', 'password']) || substr($k, -3) === 'Pwd') {//将密码字段设置为空值
                $fieldInfo[$k] = '';
            }
        }
        return $fieldInfo;
    }

    public static function setField($optab = '')
    {
        $field = Lev::stripTags(Lev::GPv('field'));
        $val = trim(Lev::GPv('val'));
        if ($field == 'inputname' && $errMsg = static::checkErrorInputname(Lev::stripTags($val))) {
            return $errMsg;
        }

        return SettingsHelper::setField($optab, $val);
    }

    public static function checkErrorInputname($inputname) {
        if (strpos($inputname, 'cld__') === 0) {
            return SettingsHelper::errorMsg('inputname', '字段名禁止用占位符"cld__"开头', -2200);
        }
        if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_]+$/', $inputname)) {
            return SettingsHelper::errorMsg('inputname', '只允许a-z、0-9、下划线必须以字母开头', -2201);
        }

        $iden = static::saveIden();
        $opid = intval(Lev::GPv('opid'));
        $sql = "moduleidentifier='$iden' AND inputname='{$inputname}' AND id<>$opid";
        $ck = SettingsHelper::findOne($sql);
        if ($ck) {
            return SettingsHelper::errorMsg('inputname', '字段名已经存在', -2202);
        }
        return false;
    }

    public static function checkErrorIden($iden) {
        if (!preg_match('/^[a-zA-Z0-9_][a-zA-Z0-9_\/]+$/', $iden)) {
            return SettingsHelper::errorMsg('iden', '只允许a-z、0-9、/和下划线，禁止以"/"开头', -2201);
        }
        return false;
    }

    public static function saveIden($default = '') {
        return Lev::stripTags(Lev::GPv('iden')) ?: ($default ?: Lev::$app['iden']);
    }

    public static function save()
    {
        $iden = static::saveIden();

        $opid = intval(Lev::GPv('opid'));
        $opInfo = $opid >0 ? SettingsHelper::findOne(['id'=>$opid]) : [];
        $upData['settings'] = $opInfo ? $opInfo['settings'] : [];

        $upData['status'] = intval(Lev::POSTv('status'));
        $upData['classify'] = Lev::stripTags(Lev::decodeHtml(Lev::POSTv('classify')));
        $upData['title'] = Lev::removeScript(Lev::decodeHtml(Lev::POSTv('title')));
        if (empty($upData['title'])) {
            return SettingsHelper::errorMsg('title', '字段标题不能为空', -2100);
        }
        $inputtypes = inputsWidget::inputtype();
        $upData['inputtype'] = Lev::stripTags(Lev::POSTv('inputtype'));
        if (!isset($inputtypes[$upData['inputtype']])) {
            return SettingsHelper::errorMsg('inputtype', '抱歉，字段类型错误', -2102);
        }
        $upData['inputname'] = Lev::stripTags(Lev::POSTv('inputname'));
        if ($errMsg = static::checkErrorInputname($upData['inputname'])) {
            if (!$upData['status'] && empty($opInfo['status'])) {
                return $errMsg;
            }
            $sql = "moduleidentifier='$iden' AND inputname='{$upData['inputname']}' AND classify='{$upData['classify']}' AND id<>$opid";
            $ck = SettingsHelper::findOne($sql);
            if ($ck) {
                return $errMsg;
            }
        }

        if ($errMsg = static::checkErrorIden($iden)) {
            return $errMsg;
        }

        $tabClassify = SettingsHelper::tabClassify($iden);
        if ($isForm = (Lev::GPv('isForm') || isset($tabClassify[$upData['classify']]))) {
            !$upData['status'] && $upData['status'] = 1;
        }

        $upData['moduleidentifier'] = $iden;
        $upData['placeholder'] = (Lev::decodeHtml(Lev::POSTv('placeholder')));
        $upData['inputvalue'] = (Lev::decodeHtml(Lev::POSTv('inputvalue'), true, false));
        $upData['displayorder'] = intval(Lev::POSTv('displayorder'));

        //$upData['settings'] = Lev::getSettings(SettingsHelper::getFormSettings(Lev::POSTv('tablesFormv'), $upData['settings']), 'settings');

        $upData['uptime'] = Lev::$app['timestamp'];
        if (tablesForm::checkInputtype($upData['inputtype'])) {
            $where = $opInfo ? ['id' => $opid] : [];
            $upData['settings'] = inputsWidget::setDefaultSettings($upData['inputtype'], $upData['settings']);
            $rs = SettingsHelper::saveInputs($upData, $where, true, [], static::formInputs());
        }else {
            $upData['settings'] = trim((Lev::decodeHtml(Lev::POSTv('settings'))));
            $upData['settings'] = inputsWidget::setDefaultSettings($upData['inputtype'], $upData['settings']);
            if ($opInfo) {
                $rs = SettingsHelper::update($upData, ['id' => $opid]);
            } else {
                $upData['addtime'] = Lev::$app['timestamp'];
                $rs = SettingsHelper::insert($upData);
            }
        }
        if ($rs) {
            inputsWidget::setCaches($iden);
            return Lev::responseMsg();
        }
        return Lev::responseMsg(-2203, '保存失败');
    }

    public static function saveOneSettings($title, $inputname, $classify, $iden = null, $inputtype = 'text', $status = 0) {
        $_POST['status'] = $status;
        $_POST['classify'] = $classify;
        $_POST['inputtype'] = $inputtype;
        $_POST['iden'] = $iden ?: Lev::$app['iden'];
        $_POST['title'] = $title;
        $_POST['inputname'] = $inputname;
        return static::save();
    }

    public static function formInputs() {
        return array (
            'classify' =>
                array (
                    'classify' => '',
                    'title' => '分类',
                    'placeholder' => '',
                    'inputname' => 'classify',
                    'inputtype' => 'selectcode',
                    'inputvalue' => '',
                    'settings' => '\\lev\\helpers\\SettingsHelper',
                    'displayorder' => '0',
                    'status' => '0',
                ),
            'title' =>
                array (
                    'classify' => '',
                    'title' => '输入框标题',
                    'placeholder' => '',
                    'inputname' => 'title',
                    'inputtype' => 'text',
                    'inputvalue' => '',
                    'settings' => '',
                    'displayorder' => '1',
                    'status' => '0',
                ),
            'inputname' =>
                array (
                    'classify' => '',
                    'title' => '输入框名[name]',
                    'placeholder' => '字段名以<b class=red>html</b>结尾，将允许用户输入html元素<br>同时支持数据表格字段',
                    'inputname' => 'inputname',
                    'inputtype' => 'text',
                    'inputvalue' => '',
                    'settings' => '',
                    'displayorder' => '2',
                    'status' => '0',
                ),
            'inputtype' =>
                array (
                    'classify' => '',
                    'title' => '输入框类型[type]',
                    'placeholder' => '',
                    'inputname' => 'inputtype',
                    'inputtype' => 'selectcode',
                    'inputvalue' => 'text',
                    'settings' => '\\lev\\widgets\\inputs\\inputsWidget',
                    'displayorder' => '3',
                    'status' => '0',
                ),
            'settings' =>
                array (
                    'classify' => '',
                    'title' => '扩展设置',
                    'placeholder' => '',
                    'inputname' => 'settings',
                    'inputtype' => 'textarea',
                    'inputvalue' => '',
                    'settings' => '',
                    'displayorder' => '4',
                    'status' => '0',
                ),
            'settings__tablesForm' =>
                array (
                    'classify' => '',
                    'title' => '子表单字段',
                    'placeholder' => '',
                    'inputname' => 'settings__tablesForm',
                    'inputtype' => 'tablesForm',
                    'inputvalue' => '',
                    'settings' => '',
                    'displayorder' => '4',
                    'status' => '0',
                ),
            'placeholder' =>
                array (
                    'classify' => '',
                    'title' => '输入框提示语[placeholder]',
                    'placeholder' => '简单明了的提示，有助于使用者更好的理解他的用途',
                    'inputname' => 'placeholder',
                    'inputtype' => 'textarea',
                    'inputvalue' => '',
                    'settings' => '',
                    'displayorder' => '5',
                    'status' => '0',
                ),
            'inputvalue' =>
                array (
                    'classify' => '',
                    'title' => '输入框值[value]',
                    'placeholder' => '存储用户输入信息',
                    'inputname' => 'inputvalue',
                    'inputtype' => 'textarea',
                    'inputvalue' => '',
                    'settings' => '',
                    'displayorder' => '6',
                    'status' => '0',
                ),
            'displayorder' =>
                array (
                    'classify' => '',
                    'title' => '排序',
                    'placeholder' => '越小越靠前',
                    'inputname' => 'displayorder',
                    'inputtype' => 'number',
                    'inputvalue' => '',
                    'settings' => '',
                    'displayorder' => '7',
                    'status' => '0',
                ),
            'status' =>
                array (
                    'classify' => '',
                    'title' => '表单分步填',
                    'placeholder' => '<tips>表单分步填为0时为设置项，否则为数据表字段</tips>',
                    'inputname' => 'status',
                    'inputtype' => 'number',
                    'inputvalue' => '',
                    'settings' => '',
                    'displayorder' => '8',
                    'status' => '0',
                ),
        );
    }
}